home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / cpp / cppdef.h < prev    next >
C/C++ Source or Header  |  1992-04-13  |  12KB  |  495 lines

  1. /*
  2.  
  3.  
  4.  Copyright (C) 1990 Texas Instruments Incorporated.
  5.  
  6.  Permission is granted to any individual or institution to use, copy, modify,
  7.  and distribute this software, provided that this complete copyright and
  8.  permission notice is maintained, intact, in all copies and supporting
  9.  documentation.
  10.  
  11.  Texas Instruments Incorporated provides this software "as is" without
  12.  express or implied warranty.
  13.  
  14.  
  15.  *           S y s t e m   D e p e n d e n t
  16.  *        D e f i n i t i o n s    f o r   C P P
  17.  *
  18.  * Definitions in this file may be edited to configure CPP for particular
  19.  * host operating systems and target configurations.
  20.  *
  21.  * NOTE: cpp assumes it is compiled by a compiler that supports macros
  22.  * with arguments.  If this is not the case (as for Decus C), #define
  23.  * nomacarg -- and provide function equivalents for all macros.
  24.  *
  25.  * cpp also assumes the host and target implement the Ascii character set.
  26.  * If this is not the case, you will have to do some editing here and there.
  27.  *
  28.  *  Change History
  29.  *  19-Jan-90    DKM    Support for MVS and EBCDIC character set
  30.  *  04-May-90    MJF    Added predefined constant "sun"
  31.  *  16-Jun-91    GPD    Fixed predefines for sun, pyr and i386 architectures
  32.  */
  33.  
  34. #ifndef CPPDEFH
  35. #define CPPDEFH
  36.  
  37. #ifdef EMACS
  38.  
  39. /* Use the Emacs config file to find out what type of machine */
  40.  
  41. #define NO_SHORTNAMES
  42. #include "../src/config.h"
  43.  
  44. /* Convert Emacs's conventions for BIG_ENDIAN to cpp's convention.  */
  45. #ifdef BIG_ENDIAN
  46. #undef BIG_ENDIAN
  47. #define BIG_ENDIAN TRUE
  48. #else /* not BIG_ENDIAN */
  49. #define BIG_ENDIAN FALSE
  50. #endif /* BIG_ENDIAN */
  51.  
  52. /* Emacs uses the names index and rindex and defines them as str(r)chr if nec;
  53.    cpp uses the opposite convention.  Here we flush the macro definitions for
  54.    Emacs and add the ones cpp wants.  */
  55.  
  56. #ifdef index
  57. #undef index
  58. #undef rindex
  59. #else /* index is not defined as a macro */
  60. #define strchr index
  61. #define strrchr rindex
  62. #endif /* index is not defined as a macro */
  63.  
  64. #define NBUFF 2048
  65. #define NWORK 2048
  66.  
  67. #endif /* EMACS */
  68.  
  69. /*
  70.  * This redundant definition of TRUE and FALSE works around
  71.  * a limitation of Decus C.
  72.  */
  73. #ifndef    TRUE
  74. #define    TRUE            1
  75. #define    FALSE            0
  76. #endif
  77.  
  78. /*
  79.  * Define the HOST operating system.  This is needed so that
  80.  * cpp can use appropriate filename conventions.
  81.  */
  82. #define    SYS_UNKNOWN        0
  83. #define    SYS_UNIX        1
  84. #define    SYS_VMS            2
  85. #define    SYS_RSX            3
  86. #define    SYS_RT11        4
  87. #define    SYS_LATTICE        5
  88. #define    SYS_ONYX        6
  89. #define    SYS_68000        7
  90. #define    SYS_OS2         8
  91. #define    SYS_XENIX         9
  92. #define SYS_MVS                 10
  93. #define SYS_AIX                 11
  94.  
  95. /* Both ASCII and EBCDIC machines are supported  */
  96. #define ASCII                   1
  97. #define EBCDIC                  2
  98.  
  99. #ifndef    HOST
  100. #ifdef    unix
  101. #define    HOST            SYS_UNIX
  102. #else
  103. #ifdef    vms
  104. #define    HOST            SYS_VMS
  105. #else
  106. #ifdef    rsx
  107. #define    HOST            SYS_RSX
  108. #else
  109. #ifdef    rt11
  110. #define    HOST            SYS_RT11
  111. #else
  112. #if defined(DOS) || defined(MSDOS)
  113. #define    HOST            SYS_OS2
  114. #else
  115. #ifdef    M_XENIX
  116. #define    HOST            SYS_XENIX
  117. #else
  118. #ifdef    SYS_OSVS
  119. #define    HOST            SYS_MVS
  120. #else
  121. #if defined(_AIX)
  122. #define    HOST            SYS_AIX
  123. #endif
  124. #endif
  125. #endif
  126. #endif
  127. #endif
  128. #endif
  129. #endif
  130. #endif
  131. #endif
  132.  
  133. #ifndef    HOST
  134. #define    HOST            SYS_UNKNOWN
  135. #endif
  136.  
  137. /*
  138.  * We assume that the target is the same as the host system
  139.  */
  140. #ifndef    TARGET
  141. #define    TARGET            HOST
  142. #endif
  143.  
  144. /*
  145.  * In order to predefine machine-dependent constants,
  146.  * several strings are defined here:
  147.  *
  148.  * MACHINE    defines the target cpu (by name)
  149.  * SYSTEM    defines the target operating system
  150.  * COMPILER    defines the target compiler
  151.  * CHARSET      character set used, ASCII or EBCDIC (defaults ASCII).
  152.  *
  153.  *    The above may be #defined as "" if they are not wanted.
  154.  *    They should not be #defined as NULL.
  155.  *
  156.  * LINE_PREFIX    defines the # output line prefix, if not "line"
  157.  *        This should be defined as "" if cpp is to replace
  158.  *        the "standard" C pre-processor.
  159.  *
  160.  * FILE_LOCAL    marks functions which are referenced only in the
  161.  *        file they reside.  Some C compilers allow these
  162.  *        to be marked "static" even though they are referenced
  163.  *        by "extern" statements elsewhere.
  164.  *
  165.  * OK_DOLLAR    Should be set TRUE if $ is a valid alphabetic character
  166.  *        in identifiers (default), or zero if $ is invalid.
  167.  *        Default is TRUE.
  168.  *
  169.  * OK_CONCAT    Should be set TRUE if ## may be used to concatenate
  170.  *        tokens in macros (per the Ansi Draft Standard) or
  171.  *        FALSE for old-style # processing (needed if cpp is
  172.  *        to process assembler source code).
  173.  *
  174.  * OK_DATE    Predefines the compilation date if set TRUE.
  175.  *        Not permitted by the Nov. 12, 1984 Draft Standard.
  176.  *
  177.  * S_CHAR etc.    Define the sizeof the basic TARGET machine word types.
  178.  *        By default, sizes are set to the values for the HOST
  179.  *        computer.  If this is inappropriate, see the code in
  180.  *        cpp3.c for details on what to change.  Also, if you
  181.  *        have a machine where sizeof (signed int) differs from
  182.  *        sizeof (unsigned int), you will have to edit code and
  183.  *        tables in cpp3.c (and extend the -S option definition.)
  184.  *
  185.  * CPP_LIBRARY    May be defined if you have a site-specific include directory
  186.  *        which is to be searched *before* the operating-system
  187.  *        specific directories.
  188.  */
  189.  
  190. #if TARGET == SYS_LATTICE
  191. /*
  192.  * We assume the operating system is pcdos for the IBM-PC.
  193.  * We also assume the small model (just like the PDP-11)
  194.  */
  195. #define MACHINE            "i8086"
  196. #define    SYSTEM            "pcdos"
  197. #endif
  198.  
  199. #if TARGET == SYS_ONYX
  200. #define    MACHINE            "z8000"
  201. #define    SYSTEM            "unix"
  202. #endif
  203.  
  204. #if TARGET == SYS_VMS
  205. #define    MACHINE            "vax"
  206. #define    SYSTEM            "vms"
  207. #define    COMPILER        "vax11c"
  208. #endif
  209.  
  210. #if TARGET == SYS_RSX
  211. #define    MACHINE            "pdp11"
  212. #define    SYSTEM            "rsx"
  213. #define    COMPILER        "decus"
  214. #endif
  215.  
  216. #if TARGET == SYS_RT11
  217. #define    MACHINE            "pdp11"
  218. #define    SYSTEM            "rt11"
  219. #define    COMPILER        "decus"
  220. #endif
  221.  
  222. #if TARGET == SYS_XENIX
  223. #define    MACHINE            "I80386"
  224. #define    SYSTEM            "M_XENIX"
  225. #define    COMPILER        "XENIXC"
  226. #endif
  227.  
  228. #if TARGET == SYS_OS2
  229. #define    MACHINE            "I80386"
  230. #define    SYSTEM            "DOS"
  231. #define    COMPILER        "IBMC2"
  232. #endif
  233.  
  234. #if TARGET == SYS_MVS
  235. #define    MACHINE            "IBM370"
  236. #define    SYSTEM            "MVS"
  237. #define    COMPILER        "SAS/C"
  238. #define CHARSET                 EBCDIC
  239. #endif
  240.  
  241. #if TARGET == SYS_AIX
  242. #define    MACHINE            "RS6000"
  243. #define    SYSTEM            "AIX"
  244. #define    COMPILER        "IBMCC"
  245. #endif
  246.  
  247. #if TARGET == SYS_68000
  248. /*
  249.  * All three machine designators have been seen in various systems.
  250.  * Warning -- compilers differ as to sizeof (int).  cpp3 assumes that
  251.  * sizeof (int) == 2
  252.  */
  253. #define    MACHINE            "M68000", "m68000", "m68k"
  254. #define    SYSTEM            "unix"
  255. #endif
  256.  
  257. #if    TARGET == SYS_UNIX
  258. #define    SYSTEM            "unix"
  259. #ifdef    pdp11
  260. #define    MACHINE            "pdp11"
  261. #endif
  262. #ifdef    vax
  263. #define    MACHINE            "vax"
  264. #endif
  265. #ifdef  sparc
  266. #define MACHINE                 "sparc"
  267. #endif
  268. #ifdef  mc68020
  269. #define MACHINE                 "mc68020", "mc68000"
  270. #endif
  271. #ifdef  sun
  272. #define TARGET_ARCH             "sun"
  273. #endif
  274. #ifdef  pyr
  275. #define MACHINE                 "pyr"
  276. #endif
  277. #ifdef  i386
  278. #define MACHINE                 "i386"
  279. #endif
  280. #endif
  281.  
  282. /*
  283.  * defaults
  284.  */
  285.  
  286. #ifndef CHARSET
  287. #define CHARSET                 ASCII
  288. #endif
  289.  
  290. #ifndef MSG_PREFIX
  291. #define MSG_PREFIX        "cpp: "
  292. #endif
  293.  
  294. #ifndef LINE_PREFIX
  295. #ifdef    decus
  296. #define    LINE_PREFIX        ""
  297. #else
  298. #define LINE_PREFIX        "line"
  299. #endif
  300. #endif
  301.  
  302. /* create a string that can be shoved on the preset symbols list
  303.  * so programs running this cpp can test for ASCII or EBCDIC too.
  304.  */
  305. #if CHARSET == EBCDIC
  306. #define CH_SET                  "EBCDIC"
  307. #else
  308. #define CH_SET                  "ASCII"
  309. #endif
  310.  
  311.  
  312. /*
  313.  * OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT,
  314.  * COMMENT_INVISIBLE, and STRING_FORMAL to values appropriate for
  315.  * an old-style preprocessor.
  316.  */
  317.  
  318. #if    OLD_PREPROCESSOR
  319. #define    OK_DOLLAR        FALSE
  320. #define    OK_CONCAT        FALSE
  321. #define    COMMENT_INVISIBLE    TRUE
  322. #define    STRING_FORMAL        TRUE
  323. #endif
  324.  
  325. /*
  326.  * RECURSION_LIMIT may be set to -1 to disable the macro recursion test.
  327.  */
  328. #ifndef    RECURSION_LIMIT
  329. #define    RECURSION_LIMIT    1000
  330. #endif
  331.  
  332. /*
  333.  * BITS_CHAR may be defined to set the number of bits per character.
  334.  * it is needed only for multi-byte character constants.
  335.  */
  336. #ifndef    BITS_CHAR
  337. #define    BITS_CHAR        8
  338. #endif
  339.  
  340. /*
  341.  * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series)
  342.  * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits.
  343.  * It is set FALSE on machines (such as the PDP-11 and Vax-11)
  344.  * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits.
  345.  * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
  346.  */
  347. #ifndef    BIG_ENDIAN
  348. #if (HOST == SYS_MVS) || defined(i386)
  349. #define BIG_ENDIAN              TRUE      /* Is this right??? */
  350. #else
  351. #define    BIG_ENDIAN         FALSE
  352. #endif
  353. #endif
  354.  
  355. /*
  356.  * COMMENT_INVISIBLE may be defined to allow "old-style" comment
  357.  * processing, whereby the comment becomes a zero-length token
  358.  * delimiter.  This permitted tokens to be concatenated in macro
  359.  * expansions.  This was removed from the Draft Ansi Standard.
  360.  */
  361. #ifndef    COMMENT_INVISIBLE
  362. #define    COMMENT_INVISIBLE    FALSE
  363. #endif
  364.  
  365. /*
  366.  * STRING_FORMAL may be defined to allow recognition of macro parameters
  367.  * anywhere in replacement strings.  This was removed from the Draft Ansi
  368.  * Standard and a limited recognition capability added.
  369.  */
  370. #ifndef    STRING_FORMAL
  371. #define    STRING_FORMAL        FALSE
  372. #endif
  373.  
  374. /*
  375.  * OK_DOLLAR enables use of $ as a valid "letter" in identifiers.
  376.  * This is a permitted extension to the Ansi Standard and is required
  377.  * for e.g., VMS, RSX-11M, etc.   It should be set FALSE if cpp is
  378.  * used to preprocess assembler source on Unix systems.  OLD_PREPROCESSOR
  379.  * sets OK_DOLLAR FALSE for that reason.
  380.  */
  381. #ifndef    OK_DOLLAR
  382. #define    OK_DOLLAR        TRUE
  383. #endif
  384.  
  385. /*
  386.  * OK_CONCAT enables (one possible implementation of) token concatenation.
  387.  * If cpp is used to preprocess Unix assembler source, this should be
  388.  * set FALSE as the concatenation character, #, is used by the assembler.
  389.  */
  390. #ifndef    OK_CONCAT
  391. #define    OK_CONCAT        TRUE
  392. #endif
  393.  
  394. /*
  395.  * OK_DATE may be enabled to predefine today's date as a string
  396.  * at the start of each compilation.  This is apparently not permitted
  397.  * by the Draft Ansi Standard.
  398.  */
  399. #ifndef    OK_DATE
  400. #define    OK_DATE        TRUE
  401. #endif
  402.  
  403. /*
  404.  * Some common definitions.
  405.  */
  406.  
  407. #ifndef    DEBUG
  408. #define    DEBUG            FALSE
  409. #endif
  410.  
  411. /*
  412.  * The following definitions are used to allocate memory for
  413.  * work buffers.  In general, they should not be modified
  414.  * by implementors.
  415.  *
  416.  * PAR_MAC    The maximum number of #define parameters (31 per Standard)
  417.  *        Note: we need another one for strings.
  418.  * NBUFF    Input buffer size
  419.  * NWORK    Work buffer size -- the longest macro
  420.  *        must fit here after expansion.
  421.  * NEXP        The nesting depth of #if expressions
  422.  * NINCLUDE    The number of directories that may be specified
  423.  *        on a per-system basis, or by the -I option.
  424.  * BLK_NEST    The number of nested #if's permitted.
  425.  */
  426.  
  427. #ifndef PAR_MAC
  428. #define    PAR_MAC           (31 + 1)
  429. #endif
  430.  
  431. #ifndef NBUFF
  432. #define    NBUFF            512
  433. #endif
  434.  
  435. #ifndef NWORK
  436. #define    NWORK            4096
  437. #endif
  438.  
  439. #ifndef NEXP
  440. #define    NEXP            128
  441. #endif
  442.  
  443. #ifndef NINCLUDE
  444. #define    NINCLUDE        16
  445. #endif
  446.  
  447. #ifndef NPARMWORK
  448. #define    NPARMWORK        (NBUFF * 2)
  449. #endif
  450.  
  451. #ifndef BLK_NEST
  452. #define    BLK_NEST        32
  453. #endif
  454.  
  455.  
  456. /*
  457.  * Some special constants.  These may need to be changed if cpp
  458.  * is ported to a wierd machine.
  459.  *
  460.  * NOTE: if cpp is run on a non-ascii machine, ALERT and VT may
  461.  * need to be changed.  They are used to implement the proposed
  462.  * ANSI standard C control characters '\a' and '\v' only.
  463.  * DEL is used to tag macro tokens to prevent #define foo foo
  464.  * from looping.  Note that we don't try to prevent more elaborate
  465.  * #define loops from occurring.
  466.  */
  467.  
  468. #ifndef    ALERT
  469. # if CHARSET == EBCDIC
  470. #    define ALERT                   '\057'      /* EBCDIC '\a' Bell */
  471. # else
  472. #    define ALERT            '\007'    /* ASCII  '\a' Bell */
  473. #endif
  474. #endif
  475.  
  476. #ifndef    VT
  477. #define    VT            '\013'        /* Vertical Tab CTRL/K    */
  478. #endif
  479.  
  480.  
  481. #ifndef    FILE_LOCAL
  482. #ifdef    decus
  483. #define    FILE_LOCAL        static
  484. #else
  485. #ifdef    vax11c
  486. #define    FILE_LOCAL        static
  487. #else
  488. #define    FILE_LOCAL                /* Others are global    */
  489. #endif
  490. #endif
  491. #endif
  492.  
  493. #endif
  494.  
  495.